<?php

declare(strict_types=1);

namespace Modules\Pmcsignage\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 * @property $order_id
 * @property $plantype
 * @property $fplannedstarttime
 * @property $wms_code
 * @property $plan_labor
 * @property $production_time
 * @property $qty
 * @property $stock_qty
 * @property $remark
 * @property $unit
*/
class ProductionTheweekplan extends Model
{
    
     /**
     * 数据表查询
     *@$fields  string
     *@$where  []
     *@$limit  string
     */
    public static $Plantype = [
        [
            'label'=>'配置',
            'value'=>1,
        ],
        [
            'label'=>'调色',
            'value'=>2,
        ],
        [
            'label'=>'罐装',
            'value'=>3,
        ],
        [
            'label'=>'组装',
            'value'=>4,
        ],
    ];

    protected $table = 'production_theweekplan';

    protected $fillable = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'production_order_id', 'plantype', 'fplannedstarttime', 'planqty', 'plan_labor', 'production_time', 'plan_total', 'remark'];

    /**
     * @var array
     */
    protected array $fields = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'production_order_id', 'plantype', 'fplannedstarttime', 'planqty', 'plan_labor', 'production_time', 'plan_total', 'remark'];

    /**
     * @var array
     */
    protected array $form = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'production_order_id', 'plantype', 'fplannedstarttime', 'planqty', 'plan_labor', 'production_time', 'plan_total', 'remark'];

    /**
     * @var array
     */
    public array $searchable = [
        'remark' => 'like',
        'plantype' => '=',
        'production_order_id' => '=',
    ];
    
    //输出相应的时间格式
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }
    
    /**
     * 链表查询
     */
    public function detailscheckOne()
    {
        return $this->hasOne(ProductionOrder::class);//查一条
    }

    public function detailscheckAll()
    {
        return $this->hasMany(ProductionOrder::class);//查多条
    }


    
}
